/**
 * SchemaService.java
 *
 * Copyright (c) 2010 Prj.Manager All Rights Reserved.
 *
 * This source file may not be copied, modified or redistributed,
 * in whole or in part, in any form or for any reason, without the express
 * written consent of Prj.Manager .
 **/
package ro.prjmanager.service;



import ro.prjmanager.core.service.AbstractService;
import ro.prjmanager.core.service.Service;
import ro.prjmanager.dao.SchemaDao;
import ro.prjmanager.model.Schema;

import java.util.List;

/**
 * This class is business logic for schema_ table
 * It manages all transaction maded to schema_ table
 * @author Viorel Tacliciu
 * @version 1
 **/


public class SchemaService  extends AbstractService<Schema,Integer> implements Service<Schema,Integer> {

    

    public void create(Schema user){
        dao.create(user);
    }


    public void delete(Integer id){
        Schema delObj =new Schema();
        delObj.setId(id);
        dao.delete(delObj);
    }

    public Schema load(Integer id){
         return dao.find(id,false);
    }

    public List<Schema> listPag(int startPage,int resPerPage){
          return dao.listPag(startPage, resPerPage);
    }

    public List<Schema> listPagFilter(int startPage,int resPerPage,String filter){
          return dao.listPagFilter(startPage, resPerPage, filter);
    }

    public int no(String filter) {
        return dao.no(filter);
    }

    public void update( Schema entity) {
        Schema schema=dao.find(entity.getId(),false);
        schema.setName(entity.getName());
        schema.setPassword(entity.getPassword());
        schema.setUser(entity.getUser());
        dao.update(schema);
    }

    public List<Schema> listPag(int startPage, int resPerPage, String orderCol, boolean asc, Object... otherItems) {
        return dao.listPag(startPage, resPerPage,orderCol,asc, otherItems);
    }

    public List<Schema> list() {
        return dao.findAll();
    }

}
